package Controllers;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Random;

import Database.mysqlConnection;
import MessagePacks.GetAllPack;
import MessagePacks.MessagePack;
import entities.*;

/**
 *@author Juan Alapin - 324507516
 *@author Giora Yaffe - 036551281
 *@author Shachar Gritzman - 300174026
 *@author Nir Porat - 021515580
*/

public class CProcessRequestController {

/**
 * Constructs an instance of Process Request Controller
 */
public CProcessRequestController(){
	
	}

/**
 * Adding a new process to the DataBase
 * @param pr:CProcessRequest
 * @param SqlDB:mysqlConnection - SQL DataBase
 * @return The request ID
 * @throws SQLException
 */
	public int addNewRequest(CProcessRequest pr,mysqlConnection sqlDB) throws SQLException{
		int reqID = 0;
		reqID = sqlDB.addRequestToDB(pr.getinitatorID(),pr.getselectedSystem(),pr.getcurrentDescription(),pr.getchangeDescription(),pr.getreason(),pr.getcomments()); //TODO:Add File Name
		return reqID;
	}

	/**
	 * Add file to the request
	 * @param reqID - The request's ID
	 * @param fileName - name of the file
	 * @param SqlDB:mysqlConnection - SQL DataBase
	 */
public void addFileToRequest(int reqID, String fileName, mysqlConnection sqlDB) {
	sqlDB.setFileNameInRequest(reqID, fileName);
	}
}